package com.googlecode.dgwt.client.dijit.resource.stylesheet;

import com.googlecode.dgwt.client.dojo.base.BrowserSensitive;
import com.googlecode.dgwt.client.dojo.base.BrowserSensitive.ReplaceWith;
import com.googlecode.dgwt.client.dojo.base.BrowserSensitive.WhenUserAgent;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
@ReplaceWith({
    @WhenUserAgent(match="ie\\v", type=StyleSheetResources_IE.class),
    @WhenUserAgent(match="ie8", type=StyleSheetResources_IE8.class),
    @WhenUserAgent(match="gecko\\v", type=StyleSheetResources_Gecko.class)
})
public class StyleSheetResources extends ThemedResource implements BrowserSensitive {



    /*-- dijit --*/

    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijit()
     */
    public String dijit() {
        return (
                dijitHiddenFocus() +
                
                // Rows,Cells,Selectors
                
                "." + getTheme().dijitRowName() + " {" +
                    getTheme().getRowStyle() +
                "}" +
                "." + getTheme().dijitCellName() + " {" +
                    getTheme().getCellStyle() +
                "}" +
                "." + getTheme().dijitSelectorName() + " {" +
                    "white-space: nowrap;" +
                "}" +

                
                // Rows,Cells,Selectors::Odd
                
                "." + getTheme().dijitRowName() + "." + getTheme().dijitOddName() + " {" +
                    getTheme().getRowOddStyle() +
                "}" +
                "." + getTheme().dijitCellName() + "." + getTheme().dijitOddName() + " {" +
                    getTheme().getCellOddStyle() +
                "}" +
                
                
                // Rows,Cells,Selectors::Selected
                
                "." + getTheme().dijitRowName() + "." + getTheme().dijitSelectedName() + " {" +
                    getTheme().getRowSelectedStyle() +
                "}" +
                "." + getTheme().dijitCellName() + "." + getTheme().dijitSelectedName() + " {" +
                    getTheme().getCellSelectedStyle() +
                "}" +

                
                // Rows,Cells,Selectors::Focused
                
                "." + getTheme().dijitRowName() + "." + getTheme().dijitFocusedName() + " {" +
                    getTheme().getRowFocusedStyle() +
                "}" +                
                "." + getTheme().dijitCellName() + "." + getTheme().dijitFocusedName() + " {" +
                    getTheme().getCellFocusedStyle() +
                "}" +
                              
                
                // Rows,Cells,Selectors::Hover
                
                "." + getTheme().dijitRowName() + "." + getTheme().dijitHoverName() + " {" +
                    getTheme().getRowHoverStyle() +
                "}" +
                "." + getTheme().dijitCellName() + "." + getTheme().dijitHoverName() + " {" +
                    getTheme().getCellHoverStyle() +
                "}"
        );
    }
    
    
    protected String dijitHiddenFocus() {
        return (
                "." + getTheme().dijitHiddenFocusName() + " {" +
                    "position: absolute;" +
                    //"opacity: 0;" +
                    //"z-index: -1;" +
                    "top: 0px;" +
                    "border: 1px solid red;" +
                    //"top: -1000px;" + 
                    //"height: 0;" + 
                    //"width: 0;" +
                "}"                
        );
    }
    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitReset()
     */
    public String dijitReset() {
        return (
             // FIXME descomentar quando todos os CSS dojo estiverem migrados
                ""
                /*
                ".dijitReset {" +  
                    "margin: 0;" + 
                    "border: 0;" + 
                    "padding: 0;" + 
                    "line-height: normal;" + 
                    "font: inherit;" + 
                    "color: inherit;" + 
                "}"
                */
        );
    }
    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitLeft()
     */
    public String dijitLeft() {
        return "";
    }
    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitToolbar()
     */
    public String dijitToolbar() {
        return (
                ".dijitToolbar .dijitButton," +
                ".dijitToolbar .dijitDropDownButton," +
                ".dijitToolbar .dijitComboButton {" +
                    "margin: 0;" +
                "}" +
                
                
                ".dijitToolbar .dijitComboButton {" + 
                    "border-collapse: separate;" + 
                "}" + 
                
                
                ".dj_webkit .dijitToolbar button {" + // FIXME(wellsantos): dj_webkit
                    "padding: 1px 2px;" +
                "}" +
                ".dj_webkit .dijitToolbar .dijitDropDownButton {" + 
                    "padding-left: 0.3em;" + 
                "}"
                
        );
    }
    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitBorderPanel()
     */
    public String dijitBorderPanel(){
        return (
                ".dijitBorderPanel {" +
                    getTheme().getBorderPanelStyle() +
                "}"
        );
    }

    

    /*-- dijit.view --*/
    
    
    
    public String dijitIndexedView() {
        return (
                ".dijitIndexedView {" +
                    "" +
                "}"
        );
    }



    /*-- dijit.form --*/
    
    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitButton()
     */
    public String dijitButton() {
        return (
                ""
        );
    }


    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitTextBox()
     */
    public String dijitTextBox() {
        return (
                ""			
        );
    }


        
    /*-- dijit.layout --*/
    

        
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitHFlexPanel()
     */
    public String dijitHFlexPanel() {
        return (
                ".dijitHFlexPanel," +
                ".dijitHFlexPanel .dijitFlexPanelChild {" +
                    "width: 100%;" +
                "}"
        );
    }

        
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitVFlexPanel()
     */
    public String dijitVFlexPanel() {
        return (
                ".dijitVFlexPanel," +
                ".dijitVFlexPanel .dijitFlexPanelChild {" +
                    "height: 100%;" +
                "}"
        );
    }

    
    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitScrollPanel()
     */
    public String dijitScrollPanel() {
        return (
                ".dijitScrollPanel {" +
                    "width: 100%;" +
                "}"
        );
    }


    /**
     * @see com.googlecode.dgwt.client.dijit.theme.Theme#dijitListBox()
     */
    public String dijitListBox() {
        return (
                ".dijitListBox {" +
                    "width: 200px;" +
                    "height: 200px;" +
                    "cursor: default;" +
                "}" +
                ".dijitListBox ." + getTheme().dijitCellName() + " {" +
                    "width: 100%;" +
                "}" +
                ".dijitListBox ." + getTheme().dijitSelectorName() + " {" +
                    "width: auto;" +
                "}"
        );
    }

}
